package com.ruoyi.common.utils.kiam;


public class AuthUtil {
    private String token;
    private String getUserInfo;
    private OauthConfig oauthConfig = OauthConfig.getOauthConfig();

    public AuthUtil() {
        this.token = this.oauthConfig.getToken();
        this.getUserInfo = this.oauthConfig.getGetusrinfo();
    }

    public void setUrl(String url) {
        this.oauthConfig.setUrl(url);
        this.token = this.oauthConfig.getToken();
        this.getUserInfo = this.oauthConfig.getGetusrinfo();
    }

    public String getToken(String grant_type, String client_id, String redirect_uri, String client_secret, String code) {
        String content = "grant_type=" + grant_type + "&client_id=" + client_id + "&redirect_uri=" + redirect_uri + "&client_secret=" + client_secret + "&code=" + code;
        String json = null;

        try {
            json = Utils.sendUrlRequest(this.token, content, "GET");
        } catch (Exception var9) {
            var9.printStackTrace();
        }

        return json;
    }

    public String getUserInfo(String access_token, String client_id) {
        String content = "access_token=" + access_token + "&client_id=" + client_id;
        String json = null;

        try {
            json = Utils.sendUrlRequestWithGet(this.getUserInfo + "?" + content);
        } catch (Exception var6) {
            var6.printStackTrace();
        }

        return json;
    }
}